package o;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import com.huawei.gamebox.plugin.gameservice.bean.GameInfo;
import java.util.List;

public class bhg extends bhh {
    private bgz ˊ;
    private int ˎ = 0;
    private Context ˏ;
    private List<bgl> ॱ;

    public bhg(Context context, List<bgl> list, dey o_dey) {
        super(o_dey);
        this.ˏ = context;
        this.ॱ = list;
    }

    public void ˋ(int i) {
        this.ˎ = i;
    }

    public int getCount() {
        if (this.ॱ != null) {
            return this.ॱ.size();
        }
        return 0;
    }

    public boolean isViewFromObject(@NonNull View view, @NonNull Object obj) {
        return ((bgz) obj).ˏˎ() == view;
    }

    public bgz ॱ(int i) {
        bgz ˋ;
        bgl o_bgl = (bgl) this.ॱ.get(i);
        if (o_bgl != null) {
            fae ˏ = fam.ॱ().ˏ();
            if (ˏ == null || ˏ.getGameInfo() == null) {
                Object obj;
                bgz o_bgz = new bgz();
                String str = "TabPagerAdapter";
                StringBuilder append = new StringBuilder().append("buoyBridge == ").append(ˏ).append(", gameInfo = ");
                if (ˏ == null) {
                    obj = null;
                } else {
                    obj = ˏ.getGameInfo();
                }
                Logger.e(str, append.append(obj).append(", position = ").append(i).toString());
                return o_bgz;
            }
            GameInfo gameInfo = ˏ.getGameInfo();
            Bundle bundle = new Bundle();
            bundle.putString("SEGMENT_URI", o_bgl.ˎ());
            bundle.putString("ARG_TITLE", o_bgl.ॱ());
            bundle.putInt("SEGMENT_INDEX", o_bgl.ˏ());
            bundle.putString("SEGMENT_STATKEY", o_bgl.ˋ());
            bundle.putString("APPID", gameInfo.getAppId());
            bundle.putString("PACKAGENAME", gameInfo.getPackageName());
            bundle.putBoolean("NEED_OBSERVE_ACC", true);
            ˋ = bhj.ˋ(o_bgl.ˎ());
            if (ˋ == null) {
                bundle.putBoolean("SUPPORT_NETWROK_CACHE", true);
                ˋ = Type1ListSegment.ˏ(this.ˏ, bundle);
            } else {
                ˋ.ˊ(bundle);
            }
            Logger.ˎ("TabPagerAdapter", "getItem with position: " + i);
        } else {
            ˋ = new bgz();
            Logger.e("TabPagerAdapter", "tabInfo == null, position = " + i);
        }
        if (this.ˎ == i) {
            ˋ.ᐝ(true);
            return ˋ;
        }
        ˋ.ᐝ(false);
        return ˋ;
    }

    public void setPrimaryItem(@NonNull ViewGroup viewGroup, int i, @NonNull Object obj) {
        super.setPrimaryItem(viewGroup, i, obj);
        if (obj instanceof bgz) {
            bgz o_bgz = (bgz) obj;
            if (this.ˊ != o_bgz) {
                o_bgz.ˋ(i);
                if (this.ˊ != null) {
                    this.ˊ.ʽˊ();
                }
                this.ˊ = o_bgz;
            }
        }
    }
}
